<template>
  <van-button
    class="btn"
    v-model="result"
    @click="showRoad"
    icon="logistics"
  ></van-button>
</template>

<script setup>
import { RoadCondition } from "./Hooks/roadcondition"

const map = ref()
onMounted(() => {
  //初始化地图
  map.value = useGlobalMap()
})
const { handleClose, handleRoad } = RoadCondition(map)
const result = ref(0)
const showRoad = () => {
  if (result.value == 0) {
    handleRoad()
    result.value = 1
  } else {
    handleClose()
    result.value = 0
  }
}
</script>

<style scoped>
.btn {
  position: fixed;
  top: 165px;
  right: 5px;
  width: 25px;
  /* margin: 100px; */
  height: 25px;
  border-radius: 5px;
  line-height: 60px;
  /* text-align: center; */
  background: rgba(249, 249, 249, 0.5);
}
</style>
